package datas
{
	import datas.datasInterior.Enemy;
	
	import events.MonsterInfoEvent;
	
	import flash.events.Event;

	//怪物的数据信息(全部解析在此处)
	public class Monster
	{
		public static var _monster:Monster;
		private static var url:String;
		
		public var blood:uint;
		public var attackMax:uint;
		public var attackMin:uint;
		public var tempo:uint;
		public var scope:uint;
		public var power:uint;
		public var speed:uint;
		public var rebirth:uint;
		public var range:uint;
		public var time:uint;
		public var sky:Boolean;
		public var string:String;
		
		public function Monster(value:SecretKey)
		{
			var enemy:Enemy = new Enemy(url);
			enemy.addEventListener(MonsterInfoEvent.MONSTER_NEW,onMonsterNews);
		}
		
		protected function onMonsterNews(event:Event):void
		{
			var xml:XML = MonsterInfoEvent.monsterData;
			//trace(xml + "________________________");
			
			blood = xml.goblin[0].@blood;
			attackMax = xml.goblin[0].@attackMax;
			attackMin = xml.goblin[0].@attackMin;
			tempo = xml.goblin[0].@tempo;
			scope = xml.goblin[0].@scope;
			power = xml.goblin[0].@power;
			speed = xml.goblin[0].@speed;
			rebirth = xml.goblin[0].@rebirth;
			range = xml.goblin[0].@range;
			time = xml.goblin[0].@time;
			sky = xml.goblin[0].@sky;
			string = xml.goblin[0].@string;
			
		}
		public static function getInstance(_url:String):Monster{
			url = _url;
			if(_monster == null){
				_monster = new Monster(new SecretKey());
			}
			return _monster;
		}
	}
}
class SecretKey{};